﻿Imports System.Data
Imports VSModel
Imports Cls_Common

Partial Class Control_MSDS_Section05View
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hidMSDSID.Value = IIf(IsNothing(Request.QueryString("Id")), 0, CInt(Request.QueryString("Id")))
            ShowData()
        End If
    End Sub
    Protected Sub Translate()
        lblSection05Header.Text = getTranslate("lblSection05Header", Session("LanguageId"), lblSection05Header.Text)
        lblS511.Text = getTranslate("lblS511", Session("LanguageId"), lblS511.Text)
        lblS521.Text = getTranslate("lblS521", Session("LanguageId"), lblS521.Text)
        lblS531.Text = getTranslate("lblS531", Session("LanguageId"), lblS531.Text)
        lblS541.Text = getTranslate("lblS541", Session("LanguageId"), lblS541.Text)
        lblS551.Text = getTranslate("lblS551", Session("LanguageId"), lblS551.Text)
        lblS561.Text = getTranslate("lblS561", Session("LanguageId"), lblS561.Text)
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            'Tiêu đề doanh nghiệp
            Dim lang = CInt(Session("LanguageId"))
            Dim Id As Integer = hidMSDSID.Value
            Dim p As MSDSSection05 = (From a In data.MSDSSection05 Where a.MSDSId = Id And a.LanguageId = lang).SingleOrDefault
            If Not IsNothing(p) Then
                hidID.Value = p.Section05Id

                'Content
                lblViewS511.Text = IIf(IsNothing(p.S511) = True, "", p.S511)
                lblViewS521.Text = IIf(IsNothing(p.S521) = True, "", p.S521)
                lblViewS531.Text = IIf(IsNothing(p.S531) = True, "", p.S531)
                lblViewS541.Text = IIf(IsNothing(p.S541) = True, "", p.S541)
                lblViewS551.Text = IIf(IsNothing(p.S551) = True, "", p.S551)
                lblViewS561.Text = IIf(IsNothing(p.S561) = True, "", p.S561)
            End If
            'Label
            Translate()
        End Using
    End Sub
End Class
